export const api = {
		//获取Banner数据
		'getBannerApi':function(){
			let api = `allBanners{
				    id
				    title
				    img
				    level
				    link
				  }`;
			return api;	  
		},
		//获取港险概览
		'getInsuranceOverApi':function(){
			let api=`allRecommendProducts{
				    id
				    img
				    level
				    product {
				      title
				      id
				      subhead
				      description
				    }
				  }`;
			return api; 
		},
		//获取新闻数据
		'getNewsListApi':function(page,pageSize){
			let api=`listNews(page: `+page+`, pageSize: `+pageSize+`) {
				    id
				    title
				    content
				    img
				    updateTime
				  }`;
			return api;
		},
		//获取保险公司
		'getAllInsurCompaniesApi':function(){
			let api=`allInsurCompanies {
						id
						title
						companyLogo
				}`;
			return api;	
		},
		//获取保险产品列表
		'getProuctApi':function(companyId_In,category_In,page,pageSize){
			let where = '';
			if(companyId_In.length>0) where=where+`companyId_In: [`+companyId_In+`],`;
			if(category_In.length>0){
				let liet='';
				for (let i=0;i<category_In.length;i++) {
					liet = liet +'"'+ category_In[i]+'",';
				}
				where=where+`category_In: [`+liet+`],`;
			}
			
			let api = `listProducts( `+where+`page: `+page+`, pageSize: `+pageSize+`) {
				    id
				    title
				    productImg
				    guaranteePeriod
				    premiumYears
				    company{
				      id
				      title
				    }
				    ageLimit
				    coverage
				    diseaseNumber
				    compensationNumber
				    compensationAmount
				    productPresentation
						isSupportFamilyPlan
				    currencies {
				      slug
				      name
				    }
				  }`;
			return api;		
		},
		//搜索产品
		'searchProductApi':function(keyword){
			let api =`searchProducts(keyword: `+keyword+`) {
			    	id
				    title
				    productImg
				    company{
				      id
				      title
				    }
				    guaranteePeriod
				    premiumYears
				    ageLimit
				    coverage
				    diseaseNumber
				    compensationNumber
				    compensationAmount
				    productPresentation
				    currencies {
				      slug
				      name
				    }
			  }`;
			return api;
		},
		
		//登陆接口
		'loginApi':function(username,password){
			let api=`mutation{
							userLogin(username:`+username+`,password:`+password+`){
								sid
								user {
									id
									username
									userprofile {
										name
									}
								}
							}
						}`;
			return api;	
		},
		//授权接口
		'UpdateUserPrivacyAuthorize':function(sid,isAllowed){
			let api = `mutation{
				updateUserPrivacyAuthorize(isAllowed:`+isAllowed+`,sid:`+sid+`){
					ok
				}
			}`;
			return api;
		},
		
		//获取短信验证码
		'getSMSCode':function(areaCode,moblie){
			let api=`mutation {
						resetPasswordSmsSend(areaCode: `+areaCode+`, mobile: `+moblie+`) {
							ok
						}
					}`;
				return api;	
		},
		
		//修改密码并登陆
		'resPasswordLogin':function(code,moblile,arecode,password){
			let api=`mutation {
						resetPasswordAndLogin(smsCode:`+code+`, mobile: `+moblile+`, areaCode: `+arecode+`, password: `+password+`) {
							sid
							user{
									id
									username
									userprofile {
										name
									}
								}
						}
					}`;
			return api;	
		},
		//所有的保险公司
		'allInsurCompaniesApi':function(){
			let api=`allInsurCompanies {
						id
						title
						companyLogo
				}`;
			return api;	
		},
		
		//通用文件
		'generaFileApi':function(companyId){
			let api=` listGeneralDownloads(companyId: `+companyId+`) {
					id
					title
					targetFile
				}`;
			return api; 
		},
		//产品文件下载
		'tableFileApi':function(companyId){
			let api=` listTableDownloads(companyId: `+companyId+`) {
					id
					title
					targetFile
				}`;
			return api;  
		},
		//帮助中心
		'helpListApi':function(){
			let api=` allFaqs {
						id
						title
						content
						category
					}`;
			return api;	  
		},
		//在线咨询
		'sendConulstApi':function(username,contact,conten){
			let api=`mutation {
					customerConsultSubmit(customerName: `+username+`, contact: `+contact+`, content: `+conten+`) {
						ok
					}
				}`;
			return api;	
		},
		//我的保单
		'myPolicyListApi':function(sid){
			let api=`listApplicantOrder(sid: `+sid+`) {
						premium
						preminumType
						currency
						year 
						signDate
						approvalDate
						status
						claimStatus
						product {
								title
							}
						follower{
							user{
								userprofile{
									name
									mobile
								}
							}
						}
						applicant{
							userprofile{
								name
								mobile
								idNo
							}
						}
						id
						insurantName
						insurantIdNo
						product{
							company{
								title
							}
						}
					}`;
			return api;
		},
		//续保提醒
		'policyRemineApi':function(sid){
			let api=`listApplicantRenewaltip(sid:`+sid+`){
					id
					renewalDate
					order{
						id
						signDate
						premium
						currency
					}
				}`;
			return api; 
		},
		//查看单个保单
		'policyInfoApi':function(id){
			let api=`queryOrder(id: `+id+`) {
						premium
						preminumType
						currency
						year 
						signDate
						approvalDate
						status
						claimStatus
						product {
								title
							}
						follower{
							user{
								userprofile{
									name
									mobile
								}
							}
						}
						applicant{
							userprofile{
								name
								mobile
								idNo
							}
						}
						id
						insurantName
						insurantIdNo
						product{
							company{
								title
							}
						}
					}`;
				return api;  
		},
		//获取新闻详情
		'getNewsInfo':function(id){
			let api = ` queryNews(id: `+id+`) {
						id
						title
						updateTime
						content
					}`;
			return api;	 
		},
		
		//获取产品详情
		'getInsuranceInfoApi':function(id){
			let api = `queryProduct(id: `+id+`) {
								id
								title
							subhead
							productImg
							category
							productPresentation
							showOrder
							description
							currencies {
								name
								slug
							}
							company {
								id
								title
							}
							premiumYears
							ageLimit
							coverage
							guaranteePeriod
							compensationNumber
							compensationAmount
							expectedReturnYear
							expectedReturnRate
							guaranteedReturnYear
							guaranteedReturnRate
							maximumLeverRatio
							diseaseNumber
							lightDiseaseNumber
							otherGuaranteeInfo
							specialGuarantee
							compensation
							recuperateInterest
							lifetimeCompensationLimit
							regionScope
							wardLevel
							mainGuarantee
					}`;
			return api;
		},
		//获取所有的保险产品
		'allProducts':function(){
			let api =`allProducts{
				id
				title
				category
				isSupportFamilyPlan
				premiumYears
				currencies{
					name
					slug
				}
			}`;
			return api;
		},
		
		/* 
		 注册
		 */
		//获取注册二维码
		'regSendSmsCode':function(areaCode,mobile){
			let api = `mutation{
					regSendSmsCode(areaCode:`+areaCode+`,mobile:`+mobile+`){
						ok
					}
			}`;
			return api;
		},
		//获取注册的Token API
		'regSmsCodeVerify':function(areaCode,smsCode,mobile){
			let api = `mutation{
				regSmsCodeVerify(areaCode:`+areaCode+`,smsCode:`+smsCode+`,mobile:`+mobile+`){
					ok
					regToken
				}
			}`;
			return api;
		},
		//注册
		'regUserSetProfile':function(regToken,confirmPassword,name,password){
			let api = `mutation{
				regUserSetProfile(regToken:`+regToken+`,confirmPassword:`+confirmPassword+`,name:`+name+`,password:`+password+`){
					ok
					user {
						id
						username
						userprofile {
							name
							mobile
						}
					}
				}
			}`;
			return api;
		},
		/* 
		 Tool工具集
		 */
		//获取个人二维码信息
		'queryUserMarketingSign':function(sid){
			let api = `queryUserMarketingSign(sid:`+sid+`){
					id
					isActive
					createTime
					updateTime
					qrcodeImg
					qrcodeHint
					textSign
					isDefault
				}`;
			return api;	
		},
		
		//查询计划书和保障方案数量
		'queryUserCreatedToolsCount':function(sid){
			let api = `queryUserCreatedToolsCount(sid:`+sid+`){
				familyPlanCount
				insurancePlanCount
			}`
			return api;
		},
		//修改保存个人二维码信息
		'updateUserMarketingSign':function(qrcodeHint,textSign,sid,imgBase64){
			let api=`mutation{
				updateUserMarketingSign(qrcodeHint:`+qrcodeHint+`,textSign:`+textSign+`,sid:`+sid+`,imgBase64:`+imgBase64+`){
					ok
				}
			}`;
			return api;
		},
		//获取个人的计划书
		'listUserInsurancePlan':function(sid){
			let api = `listUserInsurancePlan(sid:`+sid+`){
					id
					createTime
					updateTime
					product{
						title
						productImg
						coverage
						
					}
					year
					gender
					age
					premium
					cashValueList {
						policyYear
						guaranteedValue
						projectedValue
						projectedMultiple
					}
			}`;
			return api;
		},
		
		//查询单个计划书
		'queryUserInsurancePlan':function(id){
			let api=`queryUserInsurancePlan(id:`+id+`){
				id
				isActive
				createTime
				updateTime
				user{
					username
					usermarketingsignSet{
						qrcodeImg
						qrcodeHint
						textSign
					}
				}
				product{
					productImg
					title
					subhead
					category
					productPresentation
					showOrder
					description
					guaranteePeriod
					features{
						content
					}
					currencies{
						name
						slug
					}
					company{
						title
					}
					productcategorycoverageSet{
						name
						coverageRate
					}
				}
				gender
				age
				year
				isSmoker
				currency{
					slug
					name
				}
				premium
				receiverName
				receiverGender
				coverage
				cashValueList{
					policyYear
					guaranteedValue
					projectedValue
					projectedMultiple
				}
			}`;
			return api;
		},
		//生成计划书
		'createUserInsurancePlan':function(receiverName,sid,year,totalCoverage,receiverGender,isSmoker,currency,age,premium,gender,productId){
			let api=`mutation{
				createUserInsurancePlan(
				receiverName:`+receiverName+`,
				sid:`+sid+`,
				year:`+year+`,
				totalCoverage:`+totalCoverage+`,
				receiverGender:`+receiverGender+`,
				isSmoker:`+isSmoker+`,
				currency:`+currency+`,
				age:`+age+`,
				premium:`+premium+`,
				gender:`+gender+`,
				productId:`+productId+`
				){
					ok
					id
				}
			}`;
			return api;
		},
		
		//查询家庭保障方案列表
		'listUserFamilyPlan':function(sid){
				let api = `listUserFamilyPlan(sid:`+sid+`) {
				    id
						createTime
						updateTime
						members{
							clientName
							gender
							age
							isSmoker
							adviceDetailList{
								clientName
								gender
								age
								year
								isSmoker
								currency{
									slug
									name
								}
								premium
								coverage
								product{
									title
									productImg
									showOrder
									category
								}
							}
						}
				  }`;
		return api;
		},
		
		//新建家庭保障方案
		'createFamilyPlan':function(sid,memberInput){
			let api = `mutation{
				createFamilyPlan(sid:`+sid+`,memberInput:`+memberInput+`){
					ok
					id
				}
			}`;
			return api;
		},
		
		//获取方案详情
		'getQueryFamilyPlanApi':function(id){
			let api = `queryFamilyPlan(id: `+id+`) {
						id
						userMarketingSign{
							qrcodeImg
							qrcodeHint
							textSign
						}
						members {
							clientName
							gender
							age
							isSmoker
							adviceDetailList {
									premium
									coverage
									year
									currency {
										slug
										name
									}
									cashValueList {
										policyYear
										
										projectedValue
										projectedMultiple
									}
									product {
											productImg
											title
											subhead
											description
											ageLimit
											category
											guaranteePeriod
											company {
													title
											}
											features {
													content
											}
											categoryCoverages {
													name
													coverageRate
											}
									}
							}
						}
					}`;
			return api;
		},
		
		//根据保费算保额
		'getCalProductRealCoverage':function(productId,premium,gender,age,year,isSmoker,currency){
			let api=`calProductRealCoverage(productId:`+productId+`,premium:`+premium+`,gender:`+gender+`,age:`+age+`,year:`+year+`,isSmoker:`+isSmoker+`,currency:`+currency+`){
				realCoverage
			}`;
			return api;
		},
		
		//根据保额算保费
		'getCalProductRealPremium':function(productId,coverage,gender,age,year,isSmoker,currency){
			let api=`calProductRealPremium(productId:`+productId+`,coverage:`+coverage+`,gender:`+gender+`,age:`+age+`,year:`+year+`,isSmoker:`+isSmoker+`,currency:`+currency+`){
				realPremium
			}`;
			return api;
		}
}